package personal.zq.practice.common.utils;

public class TransactionManagementUtils {

    private TransactionManagementUtils() {
    }

    /**
     * 高位补空白字符 / 左补空格
     *
     * @param str
     * @param totalLen
     * @return
     */
    public static String insertBlankFrontValue(String str, int totalLen) {
        StringBuilder sb = new StringBuilder();
        sb.append(str);
        if (sb.length() < totalLen) {
            while (sb.length() < totalLen) {
                sb.insert(0, " ");
            }
        }
        return sb.toString();
    }

    /**
     * 低位补空白字符  / 右补空格
     *
     * @param str
     * @param totalLen
     * @return
     */
    public static String appendBlankAfterValue(String str, int totalLen) {
        StringBuilder sb = new StringBuilder();
        sb.append(str);
        if (sb.length() < totalLen) {
            while (sb.length() < totalLen) {
                sb.append(" ");
            }
        }
        return sb.toString();
    }
}
